package de.revdev.llt.module.utility;

import javax.enterprise.context.ContextNotActiveException;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.faces.context.FacesContext;

/**
 *
 * @author f.lindermaier
 */
public class FacesProducer {

    @Produces
    @RequestScoped
    public FacesContext getFacesContext() {
        FacesContext ctx = FacesContext.getCurrentInstance();
        if (ctx == null) {
            throw new ContextNotActiveException("FacesContext is not active");
        }
        return ctx;
    }
}
